package com.example.knowman.ObService.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.knowman.ObService.OBKnowCategoryService;
import com.example.knowman.ObService.OBKnowMainService;
import com.example.knowman.ObService.OBknowLabelMainService;
import com.example.knowman.ObService.OBlabelCategoryService;
import com.example.knowman.ReturnMessage.Message;
import com.example.knowman.dao.knowLabelMainEx;
import com.example.knowman.entity.knowLabelDetail;
import com.example.knowman.entity.knowLabelMain;
import com.example.knowman.entity.labelCategory;
import com.example.knowman.mapper.KnowLabelMainMapper;
import com.example.knowman.service.IknowLabelMainService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ObKnowLabelMainServiceImpl extends ServiceImpl<KnowLabelMainMapper, knowLabelMain> implements OBknowLabelMainService {




    @Override
    public knowLabelMain getSingle(Integer knowId) {
        return this.lambdaQuery().select().eq(knowLabelMain::getKnowId,knowId).one();
    }

    @Override
    public void deleteByKnowId(Integer knowId) {
        QueryWrapper<knowLabelMain> wrapper = new QueryWrapper<>();
        wrapper.eq("\"knowId\"",knowId);
        try{
            this.remove(wrapper);
        }catch (Exception e){

        }
    }

    @Override
    public void insertFromKnowMainInsert(Integer knowId, String staffCode) {


        knowLabelMain temp = new knowLabelMain();
        temp.setKnowId(knowId);

        temp.setStaffCode(staffCode);


        try{
            this.save(temp);

        }catch (Exception e){

        }


    }


}
